import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import '../lib_core.dart';

abstract class BoostApp extends StatelessWidget {
  BoostApp({super.key});

  abstract Map<String, FlutterBoostRouteFactory> routes;

  Route<dynamic>? routeFactory(RouteSettings settings, String? uniqueId) {
    FlutterBoostRouteFactory? func = routes[settings.name];
    return FlutterSmartDialog.boostMonitor(func?.call(settings, uniqueId));
  }

  @override
  Widget build(BuildContext context) {
    return FlutterBoostApp(
      routeFactory,
      appBuilder: (home) => appBuilder(context, home),
    );
  }

  Widget appBuilder(BuildContext context, Widget home);
}
